home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / uupc11ys.zip / LIB / NORMALIZ.C < prev    next >
C/C++ Source or Header  |  1993-04-10  |  3KB  |  71 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    n o r m a l i z . c                                             */
  3. /*                                                                    */
  4. /*    Normalize a path for UUPC/extended                              */
  5. /*                                                                    */
  6. /*    Copyright (c) 1992 by Kendra Electronic Wonderworks; all        */
  7. /*    rights reserved except those explicitly granted by the          */
  8. /*    UUPC/extended license.                                          */
  9. /*--------------------------------------------------------------------*/
  10.  
  11. /*--------------------------------------------------------------------*/
  12. /*                          RCS Information                           */
  13. /*--------------------------------------------------------------------*/
  14.  
  15. /*
  16.  *    $Id: NORMALIZ.C 1.2 1993/04/11 00:32:05 ahd Exp $
  17.  *
  18.  *    Revision history:
  19.  *    $Log: NORMALIZ.C $
  20.  *     Revision 1.2  1993/04/11  00:32:05  ahd
  21.  *     Global edits for year, TEXT, etc.
  22.  *
  23.  * Revision 1.1  1992/11/22  21:06:14  ahd
  24.  * Initial revision
  25.  *
  26.  *
  27.  */
  28.  
  29. /*--------------------------------------------------------------------*/
  30. /*                   Standard library include files                   */
  31. /*--------------------------------------------------------------------*/
  32.  
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35. #include <string.h>
  36. #include <time.h>
  37. #include <sys/types.h>
  38.  
  39. /*--------------------------------------------------------------------*/
  40. /*                    UUPC/extended include files                     */
  41. /*--------------------------------------------------------------------*/
  42.  
  43. #include "lib.h"
  44.  
  45. /*--------------------------------------------------------------------*/
  46. /*    n o r m a l i z e                                               */
  47. /*                                                                    */
  48. /*    Normalize a DOS Path                                            */
  49. /*--------------------------------------------------------------------*/
  50.  
  51. char *normalize( const char *path )
  52. {
  53.    static char save[FILENAME_MAX];
  54.    int column;
  55.  
  56.    char *p = _fullpath( save, path, sizeof save );
  57.  
  58.    if ( p == NULL )
  59.       return NULL;
  60.  
  61.    while ((p = strchr(p,'\\')) != NULL)
  62.       *p++ = '/';
  63.  
  64.    column = strlen( save ) - 1;
  65.    if ( save[column] == '/' )
  66.        save[column] = '\0';
  67.  
  68.    return strlwr( save );
  69.  
  70. } /* normalize */
  71.